using System;
using FluentValidation;

namespace BookingSystem.Entities
{
    public class BookingValidator : AbstractValidator<Booking>
    {

        public BookingValidator()
        {
            RuleFor(x => x.StartDate).NotEqual( DateTime.MinValue);
            RuleFor(x => x.EndDate).NotEqual(DateTime.MinValue);
            RuleFor(x => x.StartDate).LessThan(x => x.EndDate);
            RuleFor(x => x.EndDate).GreaterThan(x => x.StartDate);
            RuleFor(x => x.Guest).NotNull();
            RuleFor(x => x.Resource).NotNull();

        }

//        private static bool NotExist(string name)
//        {
//            var service = new BrokerService();
//            return !service.BrokerExits(name);
//        }
    }
}